package com.neu.service;

import com.neu.dao.ShoppingIssueMapper;
import com.neu.vo.ShoppingBrand;
import com.neu.vo.ShoppingIssue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by yinjian by 2019/11/22
 * 常见问题 尹健
 */
@Service
@Transactional
public class ShoppingIssueService {
    @Autowired
    private ShoppingIssueMapper shoppingIssueMapper;

    //查看常见问题
    public List<ShoppingBrand> querySelective(ShoppingIssue shoppingIssue) {
        shoppingIssue.setPagenum((shoppingIssue.getPagenum()-1)*shoppingIssue.getPagesize());
            List<ShoppingBrand> list = shoppingIssueMapper.selectByExample(shoppingIssue);
            return list;
    }

    //获取总数
    public Integer gettotal() {
        return shoppingIssueMapper.gettotal();
    }

    //添加常见问题
    public int add(ShoppingIssue shoppingIssue) {
        return shoppingIssueMapper.insertSelective(shoppingIssue);
    }

    //修改常见问题
    public int updateById(ShoppingIssue shoppingIssue) {
        return shoppingIssueMapper.updateByPrimaryKeySelective(shoppingIssue);
    }

    //删除常见问题
    public int deleteById(ShoppingIssue shoppingIssue) {
        return shoppingIssueMapper.logicalDeleteByPrimaryKey(shoppingIssue);
    }
}
